<?php
/** .-------------------------------------------------------------------
* |  Software: [HDCMS framework]
* |      Site: www.hdcms.com
* |-------------------------------------------------------------------
* |    Author: 向军 <2300071698@qq.com>
* |    WeChat: aihoudun
* | Copyright (c) 2012-2019, www.houdunwang.com. All Rights Reserved.
* '-------------------------------------------------------------------*/

namespace app\admin\controller;

class Orders extends Common{
    private $db;
    public function __construct() {
        parent::__construct();
        $this->db=new \system\model\Order();
    }

    //动作
    public function index(){
    //此处书写代码...
        $ordersData=Db::table('orders')->get();
        View::with('ordersData',$ordersData);
        return view();

    }



    public function edit(){

        $oid=Q('get.oid');
//        p($oid);
        if(IS_POST){
             if($this->db->edit()){
                 message('编辑成功','','success');
             }
                 message($this->db->getError(),'','error');
        }

        $ordersData=Db::table('orders')->where('oid',$oid)->first();
        View::with('ordersData',$ordersData);
        return view();
    }
    //删除
    public function del(){
        $oid=Q('b');
        $Order_list=new \system\model\Order_list();
        $Order_list->where("oid",$oid)->delete();

        $this->db->where('oid',$oid)->delete();
        message('删除成功',u('personal.index'),'success');

    }
}
